-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
kv: remove ShouldWinOriginTimestampTie option fromcput #143096
kv: remove ShouldWinOriginTimestampTie option fromcput #143096
Conversation
The current KV writer does not use ShouldWinOriginTimestampTie, so it can be removed as unused code. The KV LDR writer stopped using this approach for tie-breaking due to two issues: 1. When replaying replicated writes, they win LWW against themselves, leading to duplicate KVs. This is inefficient, slowing performance and wasting storage until garbage collection (GC) removes the duplicates. 2. The approach fails to handle semantics correctly in three-way replication scenarios. Release note: none Epic: CRDB-48647
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 on just removing this until we can think through how we want to handle ties in the 3-way replication case a bit more.
I wonder if ties are more common on macOS where we don't have nanosecond-precise timestamps.
Thanks for the review!
The way I think we should handle this is to pick unique replication cluster ids for each LDR peer (instead of 1 == remote). Then LDR would supply the ID of the local cluster and the replicating cluster. The only adjustment we need for tie handling is a cluster should lose ties against itself to avoid writing a row multiple times. An alternative strategy is we could make the value encoding canonical and use the value to break ties. This would also make the cput based optimizations more efficient. bors r+ |
142368: crosscluster: handle lww condition failures r=jeffswenson a=jeffswenson This change aims to correct the SQL writer's LWW semantics, enabling the retirement of the KV writer. If the SQL writer observes the condition failed error's introduced by #143100, it will drop the row as a LWW loss. This closes a LWW bug where an old replicated write can overwrite a recent local tombstone. The first two commits in this PR are from: * #143096 * #143100 Release note: none Epic: [CRDB-48647](https://cockroachlabs.atlassian.net/browse/CRDB-48647) Co-authored-by: Jeff Swenson <[email protected]>
The current KV writer does not use ShouldWinOriginTimestampTie, so it can be removed as unused code. The KV LDR writer stopped using this approach for tie-breaking due to two issues:
Release note: none
Epic: CRDB-48647